package JunitTests;

import static org.junit.Assert.*;

import objectClasses.Draft;
import objectClasses.Entry;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class Entrytests {

	private static Entry test;
	private Entry test2;
	@Before
	// Will be performed before each test.
	public void testSetup()
	{
		test = new Entry("Testname", "Test","Cat", new Draft());
		System.out.println("Setup for entry tests complete.");
	}

	@Test
	public void test() {	
		assertTrue("They should be equal",test.getCategory().equals("Cat"));
		assertTrue("They should be equal",test.getUsername().equals("Testname"));
		assertTrue("They should be equal",test.getEntryMaterialsString().equals("Test"));
		try{
		Entry test2 = new Entry(null,null,null,null);
		}
		catch(NullPointerException e){
			assertNull("This should always be null null+null=null", test2);
		}
		assertFalse("They should not be equal", test.equals(test2));	
		test2= new Entry("Testname", "Test","Cat", new Draft());
		assertFalse("They should not be equal",test.equals(test2));
		assertTrue("They are in the same category", test.getCategory()==test2.getCategory());
		assertFalse("They should be unique ID numbers", test.getIdNumber()==test2.getIdNumber());
	}
	@After
	// Will be performed after each test.
	public void testComplete()
	{
		System.out.println("Entry tests complete");
	}



}
